<html>
<head><title>Initial title</title>
<script>
if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.dumpTitleChanges();
    testRunner.waitUntilDone();
}

function runTests() {
    document.title = '1. setting document.title';

    title = document.getElementsByTagName('title').item(0);

    title.text = '2. setting title.text';

    newTitle = document.createElement('title');
    newTitle.appendChild(document.createTextNode('3. appending a new title node (should not trigger a title change)'));

    document.getElementsByTagName('head').item(0).appendChild(newTitle);

    // Remove both title elements
    titleElements = document.getElementsByTagName('title');
    while (titleElements.length) {
        titleElement = titleElements[titleElements.length - 1];
        titleElement.parentNode.removeChild(titleElement);
    }
    if (window.testRunner)
        testRunner.notifyDone();
}
</script>
</head>
<body onload="setTimeout(runTests, 0);" >
</body>
</html>
